﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HL.Core.Models;
using HL.Lib.CPControllers;

namespace HL.Lib.Models
{
   
    public class MMapPriceEntity : EntityBase
    {
        [DataInfo]
        public int PriceId { get; set; }

        [DataInfo]
        public String PriceDesc { get; set; }

        [DataInfo]
        public decimal PriceFrom { get; set; }

        [DataInfo]
        public decimal PriceTo { get; set; }

        [DataInfo]
        public int DeleteFlg { get; set; }
    }

    public class MMapPriceService : ServiceBase<MMapPriceEntity>
    {
        #region Autogen by HL

        public MMapPriceService()
            : base("[MMap_Price]")
        {
        }

        private static MMapPriceService _Instance = null;

        public static MMapPriceService Instance
        {
            get { return _Instance ?? (_Instance = new MMapPriceService()); }
        }

        public List<MMapPriceEntity> GetListPrice()
        {
            return base.CreateQuery().Where(w => w.DeleteFlg == 0).ToList();
            //                base.CreateQuery().Where(w => w.DeleteFlag == 0).Select(a => new { a.WardId, a.WardName }).ToList();
        }
        

        public MMapPriceEntity GetById(int Id)
        {
            return base.CreateQuery().Where(m => m.PriceId == Id).ToSingle();
        }

        #endregion
    }
}
